<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * 微信接口 
*/
class Weixin{
    private $appId = 'wxb4ea82a450d51eb0';
    private $secret = '2a942fa05a1f8b1167ecf723fc0ba934';
    public function __construct(){
        $this->CI =& get_instance(); 
    }

    /**
     * [微信小程序登录]
     * @return [type] [description]
    */
    public function wxSmallLogin($js_code){
        $appId = $this->appId;
        $secret = $this->secret;
        $baseurl = "https://api.weixin.qq.com/sns/jscode2session?";
        $grant_type = "authorization_code";
        $url = $baseurl. "appid=$appId&secret=$secret&js_code=$js_code&grant_type=$grant_type";
        return $url;
    }
}